global soal1 soal2
global numsoal
global x0 xn h n y01 y02 numy0
global fungsi1 fungsi2
global numfungsi
global metodestring
global hasil1 hasil2 
global numhasil

% C = 1000 mikro, L = 50 mili, R = 4.7
x = [0 0.1];
h = 0.002;
y0 = [ 15 0 ]; % gak tau
y_absen = @(x,y,z)(z); % fungsi i' = y' = z
z_absen = @(x,y,z)((-4.7*z-y/(1000*10^-6))/(50*10^-3)); % fungsi i" = y" = z'
orde = [ 3 4 ];

% Orde 3
[n result1] = Runge_Kutta( x, h, y0, y_absen, orde(1));
[n result2] = Runge_Kutta( x, h, y0, z_absen, orde(1));

% Orde 4
[n result3] = Runge_Kutta( x, h, y0, y_absen, orde(2));
[n result4] = Runge_Kutta( x, h, y0, z_absen, orde(2));

result = [result1(1) result2(2) result3(1) result4(2)];

clear result1 result2 result3 result4;

%------------------------------------------------%
% Pembuatan report
%------------------------------------------------%
% Soal
soal1 = 'L*i'''' + R*i''+ (1/C)*i = 0';
numsoal = 1;
% Variabel
x0 = x(1); xn = x(2);
% h = h (variabel dan globalnya sama)
% n = n (variabel dan globalnya sama)
y01 = y0(1); y02 = y0(2);
numy0 = 2;
% Fungsi untuk perhitungan
fungsi1 = func2str(y_absen);
fungsi2 = func2str(z_absen);
numfungsi = 2;
% Metode
metodestring = 'Runge-Kutta Orde 3';
% Hasil
hasil1 = result(1);
hasil2 = result(2);
numhasil = 2;
% Generate Report
report('DifferentialEquation');
